package com.w.tank;

import com.w.learn.DrawTail;
import com.w.learn.RectDecorator;

public class DefaultFireStrage implements FireStrage{
    @Override
    public void fire(Tank tank) {

        if (!tank.live) return;
        int offset_x =  tank.getX() + Tank.WIDTH/2 - Bullet.WIDTH/2;
        int offset_y = tank.getY() + Tank.HEIGHT/2 - Bullet.HEIGHT/2;
        GameControl.INSTANCE.add(
                new DrawTail(new RectDecorator(new Bullet(offset_x, offset_y, tank.getDir(), tank.getGroup()))));
    }
}
